home *** CD-ROM | disk | FTP | other *** search
Unknown | 2000-08-22 | 5.3 KB |
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was not able to be converted.
This format is not currently supported by dexvert.
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| file
| data
| default
| |
100%
| gt2
| Kopftext: ';DLLSORT.inc V1.2 By David Newton (dave'
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 3b 44 4c 4c 53 4f 52 54 | 2e 69 6e 63 20 56 31 2e |;DLLSORT|.inc V1.|
|00000010| 32 20 42 79 20 44 61 76 | 69 64 20 4e 65 77 74 6f |2 By Dav|id Newto|
|00000020| 6e 20 28 64 61 76 65 40 | 6e 62 73 61 6d 69 67 61 |n (dave@|nbsamiga|
|00000030| 2e 64 65 6d 6f 6e 2e 63 | 6f 2e 75 6b 29 00 3b 00 |.demon.c|o.uk).;.|
|00000040| 3b 44 79 6e 61 6d 69 63 | 20 4c 69 6e 6b 65 64 20 |;Dynamic| Linked |
|00000050| 4c 69 73 74 73 20 28 77 | 69 74 68 20 76 61 72 69 |Lists (w|ith vari|
|00000060| 61 62 6c 65 20 73 69 7a | 65 64 20 69 74 65 6d 73 |able siz|ed items|
|00000070| 29 00 3b 00 3b 51 75 69 | 63 6b 53 6f 72 74 20 72 |).;.;Qui|ckSort r|
|00000080| 6f 75 74 69 6e 65 73 2e | 2e 2e 73 65 65 20 44 4c |outines.|..see DL|
|00000090| 4c 2e 47 75 69 64 65 20 | 66 6f 72 20 6d 6f 72 65 |L.Guide |for more|
|000000a0| 20 64 65 74 61 69 6c 73 | 00 3b 00 3b 46 65 65 6c | details|.;.;Feel|
|000000b0| 20 66 72 65 65 20 74 6f | 20 75 73 65 20 74 68 69 | free to| use thi|
|000000c0| 73 20 69 6e 63 6c 75 64 | 65 20 69 6e 20 61 6e 79 |s includ|e in any|
|000000d0| 20 6f 66 20 79 6f 75 72 | 20 70 72 6f 67 72 61 6d | of your| program|
|000000e0| 73 20 61 6e 79 77 61 79 | 20 79 6f 75 20 72 65 71 |s anyway| you req|
|000000f0| 75 69 72 65 2e 00 3b 41 | 6c 73 6f 20 6d 61 6b 65 |uire..;A|lso make|
|00000100| 20 61 6e 79 20 63 68 61 | 6e 67 65 73 20 79 6f 75 | any cha|nges you|
|00000110| 20 6c 69 6b 65 2c 20 61 | 6e 64 20 69 66 20 79 6f | like, a|nd if yo|
|00000120| 75 20 69 6d 70 72 6f 76 | 65 20 61 6e 79 74 68 69 |u improv|e anythi|
|00000130| 6e 67 20 28 6d 6f 73 74 | 6c 79 20 74 68 65 00 3b |ng (most|ly the.;|
|00000140| 73 6f 72 74 20 72 6f 75 | 74 69 6e 65 73 2e 2e 2e |sort rou|tines...|
|00000150| 29 20 6c 65 74 20 6d 65 | 20 6b 6e 6f 77 2c 20 73 |) let me| know, s|
|00000160| 6f 20 6f 74 68 65 72 20 | 70 65 6f 70 6c 65 20 63 |o other |people c|
|00000170| 61 6e 20 62 65 6e 65 66 | 69 74 2e 20 49 20 72 65 |an benef|it. I re|
|00000180| 71 75 69 72 65 20 6e 6f | 00 3b 72 65 6e 75 6d 65 |quire no|.;renume|
|00000190| 72 61 74 69 6f 6e 20 66 | 6f 72 20 74 68 65 20 75 |ration f|or the u|
|000001a0| 73 65 20 6f 66 20 74 68 | 69 73 20 73 6f 75 72 63 |se of th|is sourc|
|000001b0| 65 20 63 6f 64 65 2c 20 | 61 6e 64 20 49 20 61 63 |e code, |and I ac|
|000001c0| 63 65 70 74 20 6e 6f 00 | 3b 72 65 73 70 6f 6e 73 |cept no.|;respons|
|000001d0| 69 62 69 6c 69 74 79 20 | 66 6f 72 20 61 6e 79 20 |ibility |for any |
|000001e0| 68 61 72 6d 20 74 6f 20 | 68 61 72 64 77 61 72 65 |harm to |hardware|
|000001f0| 2f 73 6f 66 74 77 61 72 | 65 20 63 61 75 73 65 64 |/softwar|e caused|
|00000200| 20 64 69 72 65 63 74 6c | 79 20 6f 72 00 3b 69 6e | directl|y or.;in|
|00000210| 64 69 72 65 63 74 6c 79 | 20 66 72 6f 6d 20 74 68 |directly| from th|
|00000220| 65 20 75 73 65 20 6f 66 | 20 74 68 69 73 20 73 6f |e use of| this so|
|00000230| 75 72 63 65 20 63 6f 64 | 65 20 61 6e 64 2f 6f 72 |urce cod|e and/or|
|00000240| 20 65 78 74 72 61 63 74 | 73 20 6f 66 20 74 68 69 | extract|s of thi|
|00000250| 73 20 73 6f 75 72 63 65 | 00 3b 63 6f 64 65 20 63 |s source|.;code c|
|00000260| 6f 6d 70 69 6c 65 64 2e | 20 42 75 74 20 61 20 63 |ompiled.| But a c|
|00000270| 72 65 64 69 74 20 66 6f | 72 20 74 68 65 73 65 20 |redit fo|r these |
|00000280| 72 6f 75 74 69 6e 65 73 | 20 69 6e 20 79 6f 75 72 |routines| in your|
|00000290| 20 73 6f 66 74 77 61 72 | 65 2f 6d 61 6e 75 61 6c | softwar|e/manual|
|000002a0| 20 77 6f 75 6c 64 00 3b | 62 65 20 6e 69 63 65 20 | would.;|be nice |
|000002b0| 3a 29 2e 20 20 44 61 76 | 65 2e 2e 2e 2e 2e 00 3b |:). Dav|e......;|
|000002c0| 00 23 56 41 52 54 59 50 | 45 5f 53 54 52 49 4e 47 |.#VARTYP|E_STRING|
|000002d0| 3d 36 00 00 80 05 20 45 | 4e 44 5f 4f 46 5f 44 4c |=6.... E|ND_OF_DL|
|000002e0| 4c 5f 53 4f 52 54 00 00 | 80 09 2e 6c 20 47 45 54 |L_SORT..|...l GET|
|000002f0| 5f 41 52 52 41 59 5f 49 | 54 45 4d 7b 61 72 72 61 |_ARRAY_I|TEM{arra|
|00000300| 79 2e 6c 2c 70 6f 73 69 | 74 69 6f 6e 2e 6c 7d 00 |y.l,posi|tion.l}.|
|00000310| 20 20 3b 72 65 74 75 72 | 6e 20 74 68 65 20 6c 6f | ;retur|n the lo|
|00000320| 6e 67 20 61 74 20 70 6f | 73 69 74 69 6f 6e 20 66 |ng at po|sition f|
|00000330| 72 6f 6d 20 74 68 65 20 | 6c 6f 6e 67 77 6f 72 64 |rom the |longword|
|00000340| 20 61 72 72 61 79 00 00 | 20 20 80 7e 2e 6c 20 64 | array..| .~.l d|
|00000350| 30 2c 61 30 3a 80 7c 2e | 6c 20 23 32 2c 64 31 3a |0,a0:.|.|l #2,d1:|
|00000360| 80 3d 2e 6c 20 64 31 2c | 61 30 3a 80 7e 2e 6c 20 |.=.l d1,|a0:.~.l |
|00000370| 28 61 30 29 2c 64 30 00 | 20 20 80 11 00 80 02 20 |(a0),d0.| ..... |
|00000380| 80 09 00 00 80 08 20 53 | 45 54 5f 41 52 52 41 59 |...... S|ET_ARRAY|
|00000390| 5f 49 54 45 4d 7b 61 72 | 72 61 79 2e 6c 2c 70 6f |_ITEM{ar|ray.l,po|
|000003a0| 73 69 74 69 6f 6e 2e 6c | 2c 6c 6f 6e 67 77 6f 72 |sition.l|,longwor|
|000003b0| 64 2e 6c 7d 00 20 20 3b | 70 6c 61 63 65 20 6c 6f |d.l}. ;|place lo|
|000003c0| 6e 67 77 6f 72 64 20 69 | 6e 20 74 68 65 20 61 72 |ngword i|n the ar|
|000003d0| 72 61 79 20 61 74 20 70 | 6f 73 69 74 69 6f 6e 00 |ray at p|osition.|
|000003e0| 00 20 20 80 7e 2e 6c 20 | 64 30 2c 61 30 3a 80 7c |. .~.l |d0,a0:.||
|000003f0| 2e 6c 20 23 32 2c 64 31 | 3a 80 3d 2e 6c 20 64 31 |.l #2,d1|:.=.l d1|
|00000400| 2c 61 30 3a 80 7e 2e 6c | 20 64 32 2c 28 61 30 29 |,a0:.~.l| d2,(a0)|
|00000410| 00 20 20 80 11 00 80 02 | 20 80 08 00 00 80 08 20 |. .....| ...... |
|00000420| 50 52 49 56 41 54 45 5f | 49 4e 53 45 52 54 5f 53 |PRIVATE_|INSERT_S|
|00000430| 4f 52 54 5f 41 52 52 41 | 59 7b 61 72 72 61 79 2e |ORT_ARRA|Y{array.|
|00000440| 6c 2c 6c 62 2e 6c 2c 75 | 62 2e 6c 2c 65 6e 74 72 |l,lb.l,u|b.l,entr|
|00000450| 79 70 61 74 68 2e 6c 2c | 76 61 72 74 79 70 65 2e |ypath.l,|vartype.|
|00000460| 6c 7d 00 20 20 3b 71 75 | 69 63 6b 6c 79 20 69 6e |l}. ;qu|ickly in|
|00000470| 73 65 72 74 20 73 6f 72 | 74 20 61 6e 20 61 72 72 |sert sor|t an arr|
|00000480| 61 79 20 6f 66 20 31 32 | 20 6f 72 20 6c 65 73 73 |ay of 12| or less|
|00000490| 20 69 74 65 6d 73 00 20 | 20 3b 6f 6e 6c 79 20 74 | items. | ;only t|
|000004a0| 6f 20 62 65 20 63 61 6c | 6c 65 64 20 62 79 20 50 |o be cal|led by P|
|000004b0| 52 49 56 41 54 45 5f 51 | 55 49 43 4b 5f 53 4f 52 |RIVATE_Q|UICK_SOR|
|000004c0| 54 5f 41 52 52 41 59 7b | 7d 00 00 20 20 80 16 20 |T_ARRAY{|}.. .. |
|000004d0| 69 2e 6c 3d 6c 62 2b 31 | 20 80 18 20 75 62 00 20 |i.l=lb+1| .. ub. |
|000004e0| 20 20 20 74 2e 6c 3d 47 | 45 54 5f 41 52 52 41 59 | t.l=G|ET_ARRAY|
|000004f0| 5f 49 54 45 4d 7b 61 72 | 72 61 79 2c 69 7d 00 20 |_ITEM{ar|ray,i}. |
|00000500| 20 20 20 3b 73 68 69 66 | 74 20 65 6c 65 6d 65 6e | ;shif|t elemen|
|00000510| 74 73 20 64 6f 77 6e 20 | 75 6e 74 69 6c 20 69 6e |ts down |until in|
|00000520| 73 65 72 74 69 6f 6e 20 | 70 6f 69 6e 74 20 66 6f |sertion |point fo|
|00000530| 75 6e 64 2e 00 20 20 20 | 20 6a 2e 6c 3d 69 2d 31 |und.. | j.l=i-1|
|00000540| 00 20 20 20 20 80 0c 20 | 28 6a 3e 3d 6c 62 29 26 |. .. |(j>=lb)&|
|00000550| 28 43 4f 4d 50 41 52 45 | 5f 49 54 45 4d 53 7b 47 |(COMPARE|_ITEMS{G|
|00000560| 45 54 5f 41 52 52 41 59 | 5f 49 54 45 4d 7b 61 72 |ET_ARRAY|_ITEM{ar|
|00000570| 72 61 79 2c 6a 7d 2c 74 | 2c 65 6e 74 72 79 70 61 |ray,j},t|,entrypa|
|00000580| 74 68 2c 76 61 72 74 79 | 70 65 7d 3d 2d 31 29 00 |th,varty|pe}=-1).|
|00000590| 20 20 20 20 20 20 53 45 | 54 5f 41 52 52 41 59 5f | SE|T_ARRAY_|
|000005a0| 49 54 45 4d 7b 61 72 72 | 61 79 2c 6a 2b 31 2c 47 |ITEM{arr|ay,j+1,G|
|000005b0| 45 54 5f 41 52 52 41 59 | 5f 49 54 45 4d 7b 61 72 |ET_ARRAY|_ITEM{ar|
|000005c0| 72 61 79 2c 6a 7d 7d 3a | 6a 3d 6a 2d 31 00 20 20 |ray,j}}:|j=j-1. |
|000005d0| 20 20 80 c1 00 20 20 20 | 20 3b 6e 6f 77 20 69 6e | ... | ;now in|
|000005e0| 73 65 72 74 20 74 20 62 | 61 63 6b 20 69 6e 74 6f |sert t b|ack into|
|000005f0| 20 61 72 72 61 79 00 20 | 20 20 20 53 45 54 5f 41 | array. | SET_A|
|00000600| 52 52 41 59 5f 49 54 45 | 4d 7b 61 72 72 61 79 2c |RRAY_ITE|M{array,|
|00000610| 6a 2b 31 2c 74 7d 00 20 | 20 80 17 20 69 00 80 02 |j+1,t}. | .. i...|
|00000620| 20 80 08 00 00 80 09 2e | 6c 20 50 52 49 56 41 54 | .......|l PRIVAT|
|00000630| 45 5f 50 41 52 54 49 4f | 4e 5f 41 52 52 41 59 7b |E_PARTIO|N_ARRAY{|
|00000640| 61 72 72 61 79 2e 6c 2c | 6c 62 2e 6c 2c 75 62 2e |array.l,|lb.l,ub.|
|00000650| 6c 2c 65 6e 74 72 79 70 | 61 74 68 2e 6c 2c 76 61 |l,entryp|ath.l,va|
|00000660| 72 74 79 70 65 2e 6c 7d | 00 20 20 3b 70 61 72 74 |rtype.l}|. ;part|
|00000670| 69 6f 6e 20 74 68 65 20 | 61 72 72 61 79 20 67 69 |ion the |array gi|
|00000680| 76 65 6e 00 20 20 3b 6f | 6e 6c 79 20 74 6f 20 62 |ven. ;o|nly to b|
|00000690| 65 20 63 61 6c 6c 65 64 | 20 62 79 20 50 52 49 56 |e called| by PRIV|
|000006a0| 41 54 45 5f 51 55 49 43 | 4b 5f 53 4f 52 54 5f 41 |ATE_QUIC|K_SORT_A|
|000006b0| 52 52 41 59 7b 7d 00 20 | 20 3b 72 65 74 75 72 6e |RRAY{}. | ;return|
|000006c0| 73 20 74 68 65 20 70 69 | 76 6f 74 20 70 6f 69 6e |s the pi|vot poin|
|000006d0| 74 20 69 6e 20 61 72 72 | 61 79 00 00 20 20 3b 66 |t in arr|ay.. ;f|
|000006e0| 69 72 73 74 20 67 65 74 | 20 70 69 76 6f 74 20 28 |irst get| pivot (|
|000006f0| 61 69 6d 20 66 6f 72 20 | 6d 69 64 64 6c 65 29 20 |aim for |middle) |
|00000700| 61 6e 64 20 73 77 61 70 | 20 77 69 74 68 20 66 69 |and swap| with fi|
|00000710| 72 73 74 20 69 74 65 6d | 00 20 20 70 2e 6c 3d 6c |rst item|. p.l=l|
|00000720| 62 2b 28 28 75 62 2d 6c | 62 29 80 7d 20 31 29 3a |b+((ub-l|b).} 1):|
|00000730| 70 69 76 6f 74 2e 6c 3d | 47 45 54 5f 41 52 52 41 |pivot.l=|GET_ARRA|
|00000740| 59 5f 49 54 45 4d 7b 61 | 72 72 61 79 2c 70 7d 00 |Y_ITEM{a|rray,p}.|
|00000750| 20 20 53 45 54 5f 41 52 | 52 41 59 5f 49 54 45 4d | SET_AR|RAY_ITEM|
|00000760| 7b 61 72 72 61 79 2c 70 | 2c 47 45 54 5f 41 52 52 |{array,p|,GET_ARR|
|00000770| 41 59 5f 49 54 45 4d 7b | 61 72 72 61 79 2c 6c 62 |AY_ITEM{|array,lb|
|00000780| 7d 7d 3a 53 45 54 5f 41 | 52 52 41 59 5f 49 54 45 |}}:SET_A|RRAY_ITE|
|00000790| 4d 7b 61 72 72 61 79 2c | 6c 62 2c 70 69 76 6f 74 |M{array,|lb,pivot|
|000007a0| 7d 00 20 20 3b 73 6f 72 | 74 20 6c 62 2e 2e 2e 75 |}. ;sor|t lb...u|
|000007b0| 62 20 62 61 73 65 64 20 | 6f 6e 20 70 69 76 6f 74 |b based |on pivot|
|000007c0| 2e 2e 2e 66 69 6e 67 65 | 72 73 20 63 72 6f 73 73 |...finge|rs cross|
|000007d0| 65 64 20 66 6f 72 20 61 | 20 6d 65 64 69 75 6d 20 |ed for a| medium |
|000007e0| 70 69 76 6f 74 00 20 20 | 69 2e 6c 3d 6c 62 3a 6a |pivot. |i.l=lb:j|
|000007f0| 2e 6c 3d 75 62 00 20 20 | 80 0c 20 69 3c 6a 00 20 |.l=ub. |.. i<j. |
|00000800| 20 20 20 80 0c 20 28 43 | 4f 4d 50 41 52 45 5f 49 | .. (C|OMPARE_I|
|00000810| 54 45 4d 53 7b 47 45 54 | 5f 41 52 52 41 59 5f 49 |TEMS{GET|_ARRAY_I|
|00000820| 54 45 4d 7b 61 72 72 61 | 79 2c 6a 7d 2c 70 69 76 |TEM{arra|y,j},piv|
|00000830| 6f 74 2c 65 6e 74 72 79 | 70 61 74 68 2c 76 61 72 |ot,entry|path,var|
|00000840| 74 79 70 65 7d 3d 2d 31 | 29 00 20 20 20 20 20 20 |type}=-1|). |
|00000850| 6a 3d 6a 2d 31 00 20 20 | 20 20 80 c1 00 20 20 20 |j=j-1. | ... |
|00000860| 20 53 45 54 5f 41 52 52 | 41 59 5f 49 54 45 4d 7b | SET_ARR|AY_ITEM{|
|00000870| 61 72 72 61 79 2c 69 2c | 47 45 54 5f 41 52 52 41 |array,i,|GET_ARRA|
|00000880| 59 5f 49 54 45 4d 7b 61 | 72 72 61 79 2c 6a 7d 7d |Y_ITEM{a|rray,j}}|
|00000890| 00 20 20 20 20 80 0c 20 | 28 69 3c 6a 29 26 28 43 |. .. |(i<j)&(C|
|000008a0| 4f 4d 50 41 52 45 5f 49 | 54 45 4d 53 7b 47 45 54 |OMPARE_I|TEMS{GET|
|000008b0| 5f 41 52 52 41 59 5f 49 | 54 45 4d 7b 61 72 72 61 |_ARRAY_I|TEM{arra|
|000008c0| 79 2c 69 7d 2c 70 69 76 | 6f 74 2c 65 6e 74 72 79 |y,i},piv|ot,entry|
|000008d0| 70 61 74 68 2c 76 61 72 | 74 79 70 65 7d 3e 2d 31 |path,var|type}>-1|
|000008e0| 29 00 20 20 20 20 20 20 | 69 3d 69 2b 31 00 20 20 |). |i=i+1. |
|000008f0| 20 20 80 c1 00 20 20 20 | 20 53 45 54 5f 41 52 52 | ... | SET_ARR|
|00000900| 41 59 5f 49 54 45 4d 7b | 61 72 72 61 79 2c 6a 2c |AY_ITEM{|array,j,|
|00000910| 47 45 54 5f 41 52 52 41 | 59 5f 49 54 45 4d 7b 61 |GET_ARRA|Y_ITEM{a|
|00000920| 72 72 61 79 2c 69 7d 7d | 00 20 20 80 c1 00 20 20 |rray,i}}|. ... |
|00000930| 53 45 54 5f 41 52 52 41 | 59 5f 49 54 45 4d 7b 61 |SET_ARRA|Y_ITEM{a|
|00000940| 72 72 61 79 2c 69 2c 70 | 69 76 6f 74 7d 00 20 20 |rray,i,p|ivot}. |
|00000950| 80 09 20 80 07 20 69 00 | 80 02 20 80 09 00 00 80 |.. .. i.|.. .....|
|00000960| 08 20 50 52 49 56 41 54 | 45 5f 51 55 49 43 4b 5f |. PRIVAT|E_QUICK_|
|00000970| 53 4f 52 54 5f 41 52 52 | 41 59 7b 61 72 72 61 79 |SORT_ARR|AY{array|
|00000980| 2e 6c 2c 6c 62 2e 6c 2c | 75 62 2e 6c 2c 65 6e 74 |.l,lb.l,|ub.l,ent|
|00000990| 72 79 70 61 74 68 2e 6c | 2c 76 61 72 74 79 70 65 |rypath.l|,vartype|
|000009a0| 2e 6c 7d 00 20 20 3b 64 | 6f 20 74 68 65 20 61 63 |.l}. ;d|o the ac|
|000009b0| 74 75 61 6c 20 71 75 69 | 63 6b 20 73 6f 72 74 2c |tual qui|ck sort,|
|000009c0| 20 6f 6e 20 61 6e 20 61 | 72 72 61 79 20 6f 66 20 | on an a|rray of |
|000009d0| 69 74 65 6d 20 70 6f 69 | 6e 74 65 72 73 00 20 20 |item poi|nters. |
|000009e0| 3b 61 6c 77 61 79 73 20 | 64 6f 20 61 6e 20 61 73 |;always |do an as|
|000009f0| 63 65 6e 64 69 6e 67 20 | 73 6f 72 74 2c 20 74 68 |cending |sort, th|
|00000a00| 65 20 72 65 74 75 72 6e | 65 64 20 61 72 72 61 79 |e return|ed array|
|00000a10| 20 63 61 6e 20 62 65 20 | 72 65 62 75 69 6c 74 20 | can be |rebuilt |
|00000a20| 65 69 74 68 65 72 00 20 | 20 3b 61 73 63 65 6e 64 |either. | ;ascend|
|00000a30| 69 6e 67 2c 20 6f 72 20 | 64 65 73 63 65 6e 64 69 |ing, or |descendi|
|00000a40| 6e 67 20 3a 29 00 20 20 | 3b 74 68 69 73 20 69 73 |ng :). |;this is|
|00000a50| 20 72 65 63 75 72 73 69 | 76 65 6c 79 20 63 61 6c | recursi|vely cal|
|00000a60| 6c 65 64 2c 20 73 6f 20 | 6d 61 6b 65 20 73 75 72 |led, so |make sur|
|00000a70| 65 20 65 6e 6f 75 67 68 | 20 73 74 61 63 6b 20 73 |e enough| stack s|
|00000a80| 70 61 63 65 20 69 73 20 | 61 76 61 69 6c 61 62 6c |pace is |availabl|
|00000a90| 65 00 00 20 20 80 0c 20 | 6c 62 3c 75 62 00 20 20 |e.. .. |lb<ub. |
|00000aa0| 20 20 80 0b 20 28 75 62 | 2d 6c 62 29 3c 3d 31 32 | .. (ub|-lb)<=12|
|00000ab0| 20 20 20 20 20 20 20 20 | 3b 71 75 69 63 6b 6c 79 | |;quickly|
|00000ac0| 20 73 6f 72 74 20 73 68 | 6f 72 74 20 6c 69 73 74 | sort sh|ort list|
|00000ad0| 73 00 20 20 20 20 20 20 | 50 52 49 56 41 54 45 5f |s. |PRIVATE_|
|00000ae0| 49 4e 53 45 52 54 5f 53 | 4f 52 54 5f 41 52 52 41 |INSERT_S|ORT_ARRA|
|00000af0| 59 7b 61 72 72 61 79 2c | 6c 62 2c 75 62 2c 65 6e |Y{array,|lb,ub,en|
|00000b00| 74 72 79 70 61 74 68 2c | 76 61 72 74 79 70 65 7d |trypath,|vartype}|
|00000b10| 3a 6c 62 3d 75 62 00 20 | 20 20 20 80 22 00 20 20 |:lb=ub. | .". |
|00000b20| 20 20 20 20 3b 70 61 72 | 74 69 6f 6e 20 69 6e 74 | ;par|tion int|
|00000b30| 6f 20 73 65 67 6d 65 6e | 74 73 00 20 20 20 20 20 |o segmen|ts. |
|00000b40| 20 6d 2e 6c 3d 50 52 49 | 56 41 54 45 5f 50 41 52 | m.l=PRI|VATE_PAR|
|00000b50| 54 49 4f 4e 5f 41 52 52 | 41 59 7b 61 72 72 61 79 |TION_ARR|AY{array|
|00000b60| 2c 6c 62 2c 75 62 2c 65 | 6e 74 72 79 70 61 74 68 |,lb,ub,e|ntrypath|
|00000b70| 2c 76 61 72 74 79 70 65 | 7d 00 20 20 20 20 20 20 |,vartype|}. |
|00000b80| 3b 73 6f 72 74 20 74 68 | 65 20 73 6d 61 6c 6c 65 |;sort th|e smalle|
|00000b90| 73 74 20 70 61 72 74 69 | 74 69 6f 6e 20 74 6f 20 |st parti|tion to |
|00000ba0| 6d 69 6e 69 6d 69 7a 65 | 20 73 74 61 63 6b 20 72 |minimize| stack r|
|00000bb0| 65 71 75 69 72 65 6d 65 | 6e 74 73 00 20 20 20 20 |equireme|nts. |
|00000bc0| 20 20 80 0b 20 28 6d 2d | 6c 62 29 3c 3d 28 75 62 | .. (m-|lb)<=(ub|
|00000bd0| 2d 6d 29 00 20 20 20 20 | 20 20 20 20 50 52 49 56 |-m). | PRIV|
|00000be0| 41 54 45 5f 51 55 49 43 | 4b 5f 53 4f 52 54 5f 41 |ATE_QUIC|K_SORT_A|
|00000bf0| 52 52 41 59 7b 61 72 72 | 61 79 2c 6c 62 2c 6d 2d |RRAY{arr|ay,lb,m-|
|00000c00| 31 2c 65 6e 74 72 79 70 | 61 74 68 2c 76 61 72 74 |1,entryp|ath,vart|
|00000c10| 79 70 65 7d 3a 6c 62 3d | 6d 2b 31 00 20 20 20 20 |ype}:lb=|m+1. |
|00000c20| 20 20 80 22 00 20 20 20 | 20 20 20 20 20 50 52 49 | .". | PRI|
|00000c30| 56 41 54 45 5f 51 55 49 | 43 4b 5f 53 4f 52 54 5f |VATE_QUI|CK_SORT_|
|00000c40| 41 52 52 41 59 7b 61 72 | 72 61 79 2c 6d 2b 31 2c |ARRAY{ar|ray,m+1,|
|00000c50| 75 62 2c 65 6e 74 72 79 | 70 61 74 68 2c 76 61 72 |ub,entry|path,var|
|00000c60| 74 79 70 65 7d 3a 75 62 | 3d 6d 2d 31 00 20 20 20 |type}:ub|=m-1. |
|00000c70| 20 20 20 80 c0 00 20 20 | 20 20 80 c0 00 20 20 80 | ... | ... .|
|00000c80| c1 00 80 02 20 80 08 00 | 00 80 08 20 42 55 49 4c |.... ...|... BUIL|
|00000c90| 44 5f 41 52 52 41 59 5f | 4f 46 5f 49 54 45 4d 53 |D_ARRAY_|OF_ITEMS|
|00000ca0| 7b 68 65 61 64 6f 66 6c | 69 73 74 2e 6c 2c 61 72 |{headofl|ist.l,ar|
|00000cb0| 72 61 79 2e 6c 7d 00 20 | 20 3b 62 75 69 6c 64 20 |ray.l}. | ;build |
|00000cc0| 61 6e 20 61 72 72 61 79 | 20 6f 66 20 69 74 65 6d |an array| of item|
|00000cd0| 73 20 66 72 6f 6d 20 74 | 68 65 20 6c 69 73 74 00 |s from t|he list.|
|00000ce0| 20 20 3b 61 72 72 61 79 | 20 73 68 6f 75 6c 64 20 | ;array| should |
|00000cf0| 61 6c 72 65 61 64 79 20 | 62 65 20 61 6c 6c 6f 63 |already |be alloc|
|00000d00| 61 74 65 64 20 77 69 74 | 68 20 6e 75 6d 62 65 72 |ated wit|h number|
|00000d10| 5f 6f 66 5f 69 74 65 6d | 73 2a 34 00 00 20 20 80 |_of_item|s*4.. .|
|00000d20| 7e 2e 6c 20 64 30 2c 61 | 30 3a 80 7e 2e 6c 20 64 |~.l d0,a|0:.~.l d|
|00000d30| 31 2c 61 31 00 42 55 49 | 4c 44 5f 41 52 52 41 59 |1,a1.BUI|LD_ARRAY|
|00000d40| 5f 4f 46 5f 49 54 45 4d | 53 5f 4c 4f 4f 50 3a 20 |_OF_ITEM|S_LOOP: |
|00000d50| 80 7e 2e 6c 20 28 61 30 | 29 2c 61 30 3a 80 b0 2e |.~.l (a0|),a0:...|
|00000d60| 6c 20 28 61 30 29 3a 80 | 48 20 42 55 49 4c 44 5f |l (a0):.|H BUILD_|
|00000d70| 41 52 52 41 59 5f 4f 46 | 5f 49 54 45 4d 53 5f 45 |ARRAY_OF|_ITEMS_E|
|00000d80| 58 49 54 00 20 20 80 7e | 2e 6c 20 61 30 2c 28 61 |XIT. .~|.l a0,(a|
|00000d90| 31 29 2b 3a 80 58 20 42 | 55 49 4c 44 5f 41 52 52 |1)+:.X B|UILD_ARR|
|00000da0| 41 59 5f 4f 46 5f 49 54 | 45 4d 53 5f 4c 4f 4f 50 |AY_OF_IT|EMS_LOOP|
|00000db0| 00 42 55 49 4c 44 5f 41 | 52 52 41 59 5f 4f 46 5f |.BUILD_A|RRAY_OF_|
|00000dc0| 49 54 45 4d 53 5f 45 58 | 49 54 3a 00 20 20 80 11 |ITEMS_EX|IT:. ..|
|00000dd0| 00 80 02 20 80 08 00 00 | 80 08 20 52 45 42 55 49 |... ....|.. REBUI|
|00000de0| 4c 44 5f 4c 49 53 54 5f | 41 52 52 41 59 5f 41 53 |LD_LIST_|ARRAY_AS|
|00000df0| 43 45 4e 44 49 4e 47 7b | 68 65 61 64 6f 66 6c 69 |CENDING{|headofli|
|00000e00| 73 74 2e 6c 2c 61 72 72 | 61 79 2e 6c 2c 6c 69 73 |st.l,arr|ay.l,lis|
|00000e10| 74 73 69 7a 65 2e 6c 7d | 00 20 20 3b 72 65 62 75 |tsize.l}|. ;rebu|
|00000e20| 69 6c 64 20 74 68 65 20 | 6c 69 6e 6b 65 64 20 6c |ild the |linked l|
|00000e30| 69 73 74 2c 20 66 72 6f | 6d 20 61 6e 20 61 72 72 |ist, fro|m an arr|
|00000e40| 61 79 20 6f 66 20 69 74 | 65 6d 73 20 28 6c 69 73 |ay of it|ems (lis|
|00000e50| 74 73 69 7a 65 20 69 74 | 65 6d 73 29 00 00 20 20 |tsize it|ems).. |
|00000e60| 80 7e 2e 6c 20 64 31 2c | 61 30 3a 80 aa 2e 6c 20 |.~.l d1,|a0:...l |
|00000e70| 23 31 2c 64 32 3a 80 7e | 2e 6c 20 64 30 2c 61 31 |#1,d2:.~|.l d0,a1|
|00000e80| 00 20 20 52 45 42 55 49 | 4c 44 5f 4c 49 53 54 5f |. REBUI|LD_LIST_|
|00000e90| 41 53 43 45 4e 44 49 4e | 47 5f 4c 4f 4f 50 3a 20 |ASCENDIN|G_LOOP: |
|00000ea0| 80 7e 2e 6c 20 28 61 30 | 29 2b 2c 61 32 3a 80 7e |.~.l (a0|)+,a2:.~|
|00000eb0| 2e 6c 20 61 32 2c 28 61 | 31 29 3a 80 7e 2e 6c 20 |.l a2,(a|1):.~.l |
|00000ec0| 61 31 2c 34 28 61 32 29 | 00 20 20 80 7e 2e 6c 20 |a1,4(a2)|. .~.l |
|00000ed0| 61 32 2c 61 31 3a 80 6f | 20 64 32 2c 52 45 42 55 |a2,a1:.o| d2,REBU|
|00000ee0| 49 4c 44 5f 4c 49 53 54 | 5f 41 53 43 45 4e 44 49 |ILD_LIST|_ASCENDI|
|00000ef0| 4e 47 5f 4c 4f 4f 50 00 | 20 20 80 7e 2e 6c 20 64 |NG_LOOP.| .~.l d|
|00000f00| 30 2c 61 32 3a 80 40 2e | 6c 20 23 34 2c 61 32 3a |0,a2:.@.|l #4,a2:|
|00000f10| 80 7e 2e 6c 20 61 32 2c | 28 61 31 29 3a 80 7e 2e |.~.l a2,|(a1):.~.|
|00000f20| 6c 20 61 31 2c 34 28 61 | 32 29 00 20 20 80 11 00 |l a1,4(a|2). ...|
|00000f30| 80 02 20 80 08 00 00 80 | 08 20 52 45 42 55 49 4c |.. .....|. REBUIL|
|00000f40| 44 5f 4c 49 53 54 5f 41 | 52 52 41 59 5f 44 45 53 |D_LIST_A|RRAY_DES|
|00000f50| 43 45 4e 44 49 4e 47 7b | 68 65 61 64 6f 66 6c 69 |CENDING{|headofli|
|00000f60| 73 74 2e 6c 2c 61 72 72 | 61 79 2e 6c 2c 6c 69 73 |st.l,arr|ay.l,lis|
|00000f70| 74 73 69 7a 65 2e 6c 7d | 00 20 20 3b 72 65 62 75 |tsize.l}|. ;rebu|
|00000f80| 69 6c 64 20 74 68 65 20 | 6c 69 6e 6b 65 64 20 6c |ild the |linked l|
|00000f90| 69 73 74 2c 20 66 72 6f | 6d 20 61 6e 20 61 72 72 |ist, fro|m an arr|
|00000fa0| 61 79 20 6f 66 20 69 74 | 65 6d 73 20 28 6c 69 73 |ay of it|ems (lis|
|00000fb0| 74 73 69 7a 65 20 69 74 | 65 6d 73 29 00 20 20 3b |tsize it|ems). ;|
|00000fc0| 61 6e 64 20 72 65 76 65 | 72 73 65 20 74 68 65 20 |and reve|rse the |
|00000fd0| 6c 69 73 74 20 66 6f 72 | 20 61 20 64 65 73 63 65 |list for| a desce|
|00000fe0| 6e 64 69 6e 67 20 73 6f | 72 74 00 00 20 20 80 7e |nding so|rt.. .~|
|00000ff0| 2e 6c 20 64 31 2c 61 30 | 3a 80 aa 2e 6c 20 23 31 |.l d1,a0|:...l #1|
|00001000| 2c 64 32 3a 80 7e 2e 6c | 20 64 30 2c 61 31 3a 80 |,d2:.~.l| d0,a1:.|
|00001010| 40 2e 6c 20 23 34 2c 61 | 31 00 20 20 52 45 42 55 |@.l #4,a|1. REBU|
|00001020| 49 4c 44 5f 4c 49 53 54 | 5f 44 45 53 43 45 4e 44 |ILD_LIST|_DESCEND|
|00001030| 49 4e 47 5f 4c 4f 4f 50 | 3a 20 80 7e 2e 6c 20 28 |ING_LOOP|: .~.l (|
|00001040| 61 30 29 2b 2c 61 32 3a | 80 7e 2e 6c 20 61 32 2c |a0)+,a2:|.~.l a2,|
|00001050| 34 28 61 31 29 3a 80 7e | 2e 6c 20 61 31 2c 28 61 |4(a1):.~|.l a1,(a|
|00001060| 32 29 00 20 20 80 7e 2e | 6c 20 61 32 2c 61 31 3a |2). .~.|l a2,a1:|
|00001070| 80 6f 20 64 32 2c 52 45 | 42 55 49 4c 44 5f 4c 49 |.o d2,RE|BUILD_LI|
|00001080| 53 54 5f 44 45 53 43 45 | 4e 44 49 4e 47 5f 4c 4f |ST_DESCE|NDING_LO|
|00001090| 4f 50 00 20 20 80 7e 2e | 6c 20 64 30 2c 61 32 3a |OP. .~.|l d0,a2:|
|000010a0| 80 7e 2e 6c 20 61 32 2c | 34 28 61 31 29 3a 80 7e |.~.l a2,|4(a1):.~|
|000010b0| 2e 6c 20 61 31 2c 28 61 | 32 29 00 20 20 80 11 00 |.l a1,(a|2). ...|
|000010c0| 80 02 20 80 08 00 00 80 | 08 20 51 55 49 43 4b 5f |.. .....|. QUICK_|
|000010d0| 53 4f 52 54 5f 4c 49 53 | 54 5f 41 53 43 45 4e 44 |SORT_LIS|T_ASCEND|
|000010e0| 49 4e 47 7b 2a 6c 69 73 | 74 68 65 61 64 2e 64 6c |ING{*lis|thead.dl|
|000010f0| 6c 68 65 61 64 2c 65 6e | 74 72 79 70 61 74 68 2e |lhead,en|trypath.|
|00001100| 6c 2c 76 61 72 74 79 70 | 65 2e 6c 7d 00 20 20 3b |l,vartyp|e.l}. ;|
|00001110| 64 6f 20 61 6e 20 61 73 | 63 65 6e 64 69 6e 67 20 |do an as|cending |
|00001120| 71 75 69 63 6b 20 73 6f | 72 74 20 6f 6e 20 61 20 |quick so|rt on a |
|00001130| 6c 69 73 74 00 20 20 3b | 6e 65 65 64 20 65 78 74 |list. ;|need ext|
|00001140| 72 61 20 6d 65 6d 6f 72 | 79 2e 2e 2e 61 74 6c 65 |ra memor|y...atle|
|00001150| 61 73 74 20 34 2a 6c 69 | 73 74 73 69 7a 65 2c 20 |ast 4*li|stsize, |
|00001160| 61 6e 64 20 73 74 61 63 | 6b 20 73 70 61 63 65 3e |and stac|k space>|
|00001170| 34 30 30 30 30 00 20 20 | 3b 64 6f 65 73 6e 27 74 |40000. |;doesn't|
|00001180| 20 63 68 61 6e 67 65 20 | 74 68 65 20 6c 69 73 74 | change |the list|
|00001190| 20 63 75 72 72 65 6e 74 | 20 69 74 65 6d 20 70 6f | current| item po|
|000011a0| 69 6e 74 65 72 00 00 20 | 20 6c 69 73 74 73 69 7a |inter.. | listsiz|
|000011b0| 65 2e 6c 3d 2a 6c 69 73 | 74 68 65 61 64 5c 64 6c |e.l=*lis|thead\dl|
|000011c0| 6c 5f 69 74 65 6d 73 69 | 6e 6c 69 73 74 00 20 20 |l_itemsi|nlist. |
|000011d0| 80 0b 20 6c 69 73 74 73 | 69 7a 65 3e 30 20 80 21 |.. lists|ize>0 .!|
|000011e0| 20 61 72 72 61 79 2e 6c | 3d a6 08 28 6c 69 73 74 | array.l|=..(list|
|000011f0| 73 69 7a 65 2a 34 2c 30 | 29 20 80 22 20 61 72 72 |size*4,0|) ." arr|
|00001200| 61 79 2e 6c 3d 30 00 20 | 20 80 0b 20 61 72 72 61 |ay.l=0. | .. arra|
|00001210| 79 3c 3e 30 00 20 20 20 | 20 42 55 49 4c 44 5f 41 |y<>0. | BUILD_A|
|00001220| 52 52 41 59 5f 4f 46 5f | 49 54 45 4d 53 7b 2a 6c |RRAY_OF_|ITEMS{*l|
|00001230| 69 73 74 68 65 61 64 2c | 61 72 72 61 79 7d 00 20 |isthead,|array}. |
|00001240| 20 20 20 50 52 49 56 41 | 54 45 5f 51 55 49 43 4b | PRIVA|TE_QUICK|
|00001250| 5f 53 4f 52 54 5f 41 52 | 52 41 59 7b 61 72 72 61 |_SORT_AR|RAY{arra|
|00001260| 79 2c 30 2c 6c 69 73 74 | 73 69 7a 65 2d 31 2c 65 |y,0,list|size-1,e|
|00001270| 6e 74 72 79 70 61 74 68 | 2c 76 61 72 74 79 70 65 |ntrypath|,vartype|
|00001280| 7d 00 20 20 20 20 52 45 | 42 55 49 4c 44 5f 4c 49 |}. RE|BUILD_LI|
|00001290| 53 54 5f 41 52 52 41 59 | 5f 41 53 43 45 4e 44 49 |ST_ARRAY|_ASCENDI|
|000012a0| 4e 47 7b 2a 6c 69 73 74 | 68 65 61 64 2c 61 72 72 |NG{*list|head,arr|
|000012b0| 61 79 2c 6c 69 73 74 73 | 69 7a 65 7d 00 20 20 20 |ay,lists|ize}. |
|000012c0| 20 a6 09 20 61 72 72 61 | 79 2c 6c 69 73 74 73 69 | .. arra|y,listsi|
|000012d0| 7a 65 2a 34 00 20 20 80 | c0 00 20 20 52 45 53 45 |ze*4. .|.. RESE|
|000012e0| 54 5f 4c 49 53 54 7b 2a | 6c 69 73 74 68 65 61 64 |T_LIST{*|listhead|
|000012f0| 7d 00 80 02 20 80 08 00 | 00 80 08 20 51 55 49 43 |}... ...|... QUIC|
|00001300| 4b 5f 53 4f 52 54 5f 4c | 49 53 54 5f 44 45 53 43 |K_SORT_L|IST_DESC|
|00001310| 45 4e 44 49 4e 47 7b 2a | 6c 69 73 74 68 65 61 64 |ENDING{*|listhead|
|00001320| 2e 64 6c 6c 68 65 61 64 | 2c 65 6e 74 72 79 70 61 |.dllhead|,entrypa|
|00001330| 74 68 2e 6c 2c 76 61 72 | 74 79 70 65 2e 6c 7d 00 |th.l,var|type.l}.|
|00001340| 20 20 3b 64 6f 20 61 20 | 64 65 73 63 65 6e 64 69 | ;do a |descendi|
|00001350| 6e 67 20 71 75 69 63 6b | 20 73 6f 72 74 20 6f 6e |ng quick| sort on|
|00001360| 20 61 20 6c 69 73 74 00 | 20 20 3b 6e 65 65 64 20 | a list.| ;need |
|00001370| 65 78 74 72 61 20 6d 65 | 6d 6f 72 79 2e 2e 2e 61 |extra me|mory...a|
|00001380| 74 6c 65 61 73 74 20 34 | 2a 6c 69 73 74 73 69 7a |tleast 4|*listsiz|
|00001390| 65 2c 20 61 6e 64 20 73 | 74 61 63 6b 20 73 70 61 |e, and s|tack spa|
|000013a0| 63 65 3e 34 30 30 30 30 | 00 20 20 3b 64 6f 65 73 |ce>40000|. ;does|
|000013b0| 6e 27 74 20 63 68 61 6e | 67 65 20 74 68 65 20 6c |n't chan|ge the l|
|000013c0| 69 73 74 20 63 75 72 72 | 65 6e 74 20 69 74 65 6d |ist curr|ent item|
|000013d0| 20 70 6f 69 6e 74 65 72 | 00 00 20 20 6c 69 73 74 | pointer|.. list|
|000013e0| 73 69 7a 65 2e 6c 3d 2a | 6c 69 73 74 68 65 61 64 |size.l=*|listhead|
|000013f0| 5c 64 6c 6c 5f 69 74 65 | 6d 73 69 6e 6c 69 73 74 |\dll_ite|msinlist|
|00001400| 00 20 20 80 0b 20 6c 69 | 73 74 73 69 7a 65 3e 30 |. .. li|stsize>0|
|00001410| 20 80 21 20 61 72 72 61 | 79 2e 6c 3d a6 08 28 6c | .! arra|y.l=..(l|
|00001420| 69 73 74 73 69 7a 65 2a | 34 2c 30 29 20 80 22 20 |istsize*|4,0) ." |
|00001430| 61 72 72 61 79 2e 6c 3d | 30 00 20 20 80 0b 20 61 |array.l=|0. .. a|
|00001440| 72 72 61 79 3c 3e 30 00 | 20 20 20 20 42 55 49 4c |rray<>0.| BUIL|
|00001450| 44 5f 41 52 52 41 59 5f | 4f 46 5f 49 54 45 4d 53 |D_ARRAY_|OF_ITEMS|
|00001460| 7b 2a 6c 69 73 74 68 65 | 61 64 2c 61 72 72 61 79 |{*listhe|ad,array|
|00001470| 7d 00 20 20 20 20 50 52 | 49 56 41 54 45 5f 51 55 |}. PR|IVATE_QU|
|00001480| 49 43 4b 5f 53 4f 52 54 | 5f 41 52 52 41 59 7b 61 |ICK_SORT|_ARRAY{a|
|00001490| 72 72 61 79 2c 30 2c 6c | 69 73 74 73 69 7a 65 2d |rray,0,l|istsize-|
|000014a0| 31 2c 65 6e 74 72 79 70 | 61 74 68 2c 76 61 72 74 |1,entryp|ath,vart|
|000014b0| 79 70 65 7d 00 20 20 20 | 20 52 45 42 55 49 4c 44 |ype}. | REBUILD|
|000014c0| 5f 4c 49 53 54 5f 41 52 | 52 41 59 5f 44 45 53 43 |_LIST_AR|RAY_DESC|
|000014d0| 45 4e 44 49 4e 47 7b 2a | 6c 69 73 74 68 65 61 64 |ENDING{*|listhead|
|000014e0| 2c 61 72 72 61 79 2c 6c | 69 73 74 73 69 7a 65 7d |,array,l|istsize}|
|000014f0| 00 20 20 20 20 a6 09 20 | 61 72 72 61 79 2c 6c 69 |. .. |array,li|
|00001500| 73 74 73 69 7a 65 2a 34 | 00 20 20 80 c0 00 20 20 |stsize*4|. ... |
|00001510| 52 45 53 45 54 5f 4c 49 | 53 54 7b 2a 6c 69 73 74 |RESET_LI|ST{*list|
|00001520| 68 65 61 64 7d 00 80 02 | 20 80 08 00 00 45 4e 44 |head}...| ....END|
|00001530| 5f 4f 46 5f 44 4c 4c 5f | 53 4f 52 54 3a 00 00 00 |_OF_DLL_|SORT:...|
|00001540| 00 | |. | |
+--------+-------------------------+-------------------------+--------+--------+